<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改运输单位类型')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-transport-edit" th:object="${transport}">
			<input id="rowkey" name="rowkey" type="hidden" th:field="*{rowkey}"/>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">运输单位类型：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="transportUnitTypeId" id="transportUnitTypeId" th:field="*{transportUnitTypeId}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">重量能力：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="weightCapacity" id="weightCapacity" th:field="*{weightCapacity}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">重量计量单位：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="uomForWeight" id="weight" th:field="*{uomForWeight}" required>
					<a class="btn btn-primary btn-rounded btn-sm" onclick="showOpen('Weight')"><i class="fa fa-search"></i>&nbsp;请选择</a>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">体积容量：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="volumeCapacity" id="volumeCapacity" th:field="*{volumeCapacity}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">体积计量单位：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="uomForVolume" id="volume" th:field="*{uomForVolume}" required>
					<a class="btn btn-primary btn-rounded btn-sm" onclick="showOpen('Volume')"><i class="fa fa-search"></i>&nbsp;请选择</a>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">描述：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="description" id="description" th:field="*{description}" required>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "transport";
		function showOpen(value) {
			var prefixTable = ctx + "demo/modal";
			$.modal.open("选择用户", prefixTable + "/radionForisounit?unitType="+value);
		}

		$("#form-transport-edit").validate({
			onkeyup: false,
			rules:{
				transportUnitTypeId:{
					remote: {
						url: ctx + "system/post/checkPostNameUnique",
						type: "post",
						dataType: "json",
						data: {
							"transportUnitTypeId" : function() {
								return $.common.trim($("#transportUnitTypeId").val());
							}
						},
						dataFilter: function(data, type) {
							return $.validate.unique(data);
						}
					}
				},
				weightCapacity:{
					number:true
				},
				volumeCapacity:{
					number:true
				},
			},
			messages: {
				"transportUnitTypeId": {
					remote: "运输类型已经存在"
				}
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/edit", $('#form-transport-edit').serialize());
	        }
	    }
	</script>
</body>
</html>
